<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            text-align: center;
        }

        button {
            width: 200px;
            height: 50px;
            font-size: 30px;
        }
    </style>
</head>

<body>
    <!-- 
        let timer = setInterval():定时器 , clearInterval(timer) 清除定时器
        let timer2 = setTimeout（）:延时器,clearTimeout(timer2) 清除延时器
    -->
    <div>
        <button id="start">开始</button>
        <button id="stop">停止</button>
    </div>

    <script>
        let startBenEle = document.getElementById('start');
        let stopBenEle = document.getElementById('stop');
        let timer;// 声明成全局变量
        startBenEle.addEventListener('click', function () {
            // 设置按钮禁用
            this.disabled = true;
            this.innerText = '点名中...';
            timer = setInterval(function () {
                console.log("ZZC爱打CSGO");
            }, 1000);
        });

        stopBenEle.addEventListener('click', function () {
            // 设置按钮可用
            startBenEle.disabled = false;
            startBenEle.innerText = '开始';
            // 清除上面的定时器动作
            clearInterval(timer);
        });
    </script>
</body>

</html>